# -*- coding: utf-8 -*-
"""
svm_demo
Created on Thu Apr 26 10:30:45 2018

@author: Allen
"""
import numpy as np
import matplotlib.pyplot as plt

from sklearn import datasets
X, y = datasets.make_moons()

plt.scatter( X[y==0, 0], X[y==0, 1] )
plt.scatter( X[y==1, 0], X[y==1, 1] )
plt.show()

X, y = datasets.make_moons( noise = 0.15, random_state = 666 )
plt.scatter( X[y==0, 0], X[y==0, 1] )
plt.scatter( X[y==1, 0], X[y==1, 1] )
plt.show()

from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
from sklearn.pipeline import Pipeline

def RBFKernelSVC( gamma = 1.0 ):
    return Pipeline([
                ( "std_scaler", StandardScaler() ),
                ( "svc", SVC( kernel = "rbf", gamma = gamma ) )
            ])

svc = RBFKernelSVC( gamma = 1.0 )
svc.fit( X, y )
